package com.local.web.constants;

/**
 * 首页商品配置的类型
 */
public enum CaptchaTypeEnum {

    LOGIN_CAPTCHA("login", "loginCaptcha"), //登录验证码
    COMMENT_CAPTCHA("comment", "commentCaptcha"); //评论验证码

    private String type;
    private String value;

    CaptchaTypeEnum(String type, String value) {
        this.type = type;
        this.value = value;
    }

    /**
     * 根据 type 查询对应的类型数据
     * @param type
     * @return
     */
    public static CaptchaTypeEnum getCaptchaEnumByType(String type) {
        for (CaptchaTypeEnum value : CaptchaTypeEnum.values()) {
            if (type.equalsIgnoreCase(value.getType())) {
                return value;
            }
         }
        return LOGIN_CAPTCHA;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
